package com.gold;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author XiaoHao
 * @date 2022-04-13 09:59
 */
@SpringBootApplication
@MapperScan({"com.gold.dao","com.gold.wechat.dao"})
@Slf4j
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        StringBuilder sb = new StringBuilder();
        sb.append("\r\n==================================================================\r\n");
        sb.append("\r\n                        欢迎使用Gold卡密系统                     \r\n");
        sb.append("\r\n==================================================================\r\n");
        System.out.println(sb);
        log.info("==============================服务启动成功================================");
    }

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
        return paginationInterceptor;
    }
}
